﻿using IntelligentAgriculture.Contracts.Dto.Input;
using IntelligentAgriculture.Contracts.Dto.Output;
using IntelligentAgriculture.Contracts.Interface;
using IntelligentAgriculture.Domain.Entity;
using IntelligentAgriculture.WebAPI.Application.Command.DeliveryPromptModelCommand;
using MediatR;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;

namespace IntelligentAgriculture.WebAPI.Controllers
{
    /// <summary>
    /// 分娩提示
    /// </summary>
    [Route("api/[controller]/[action]")]
    [ApiController]
    public class DeliveryPromptModelsController : ControllerBase
    {
        private readonly IMediator  _mediator;
        private readonly IDeliveryPromptModelService _deliveryPromptModelService;
        private readonly ILogger<DeliveryPromptModelsController> _logger;
        public DeliveryPromptModelsController(IMediator mediator, IDeliveryPromptModelService deliveryPromptModelService,ILogger<DeliveryPromptModelsController> logger)
        {
            _mediator = mediator;
            _deliveryPromptModelService = deliveryPromptModelService;
            _logger = logger;
        }
        /// <summary>
        /// 分娩提示列表
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<Results<PageOutput<DeliverypromptmodelOutput>>> GetDeliveryPromptModel(DeliveryPromptModelGetCommand command)
        {
            try
            {
                var result = await _mediator.Send(command);
                return Results<PageOutput<DeliverypromptmodelOutput>>.DataResult(result);
            }
            catch (Exception)
            {

                throw;
            }
            
        }
    }
}
